Synchronize DNS provider changes during app startup and reloads - #69
Synchronize DNS provider changes during app startup and reloads#69Himanth-reddy wants to merge 1 commit into
Conversation
|
The DNS reload logic in this PR is sound — applying the persisted provider at startup in However, this PR is currently not mergeable — it's in a To unblock merge:
Once it's rebased, CI is green again, and the DNS Provider row is still reachable via D-pad in the updated General section (same recurring gotcha as the other settings-touching PRs), this should be ready to merge. The underlying logic is fine — it's purely a rebase/conflict issue. |
- Bootstrap the persisted DNS provider during app startup - Trigger activity recreation only for explicit user DNS change events - Cancel TMDB calls, rebuild Coil, and force home content reload after DNS switches - Keep DNS preference application in sync and retain related settings/debug module adjustments
This pull request introduces a robust system for handling DNS provider changes in the app, ensuring that DNS settings are correctly applied at startup and that runtime changes trigger appropriate UI and network updates. The changes span initialization, UI, network, and settings logic, with careful handling to ensure smooth user experience and correct network behavior.
DNS Provider Change Handling and Synchronization:
ArflixApplicationto apply the persisted DNS provider at startup, ensuring the app always uses the correct DNS configuration on launch. Errors during this process are logged. [1] [2]SettingsViewModel, whenever the DNS provider preference is read, the runtime DNS provider is synchronized with the saved value. A nonce (dns_reload_nonce) is introduced to signal DNS changes. [1] [2] [3]UI and State Updates on DNS Change:
MainActivity, observes thedns_reload_noncefrom DataStore. When it changes (indicating a user-initiated DNS change), the activity is recreated to ensure all components use the new DNS settings. [1] [2]HomeViewModelnow observes DNS provider changes and, upon detection, triggers a full reload of home content and clears relevant caches and state, ensuring data consistency with the new DNS configuration. [1] [2]Network Layer Improvements:
OkHttpProvider, when the DNS provider is set, the connection pool is evicted and any in-flight TMDB API calls are cancelled to prevent stale DNS resolution, improving reliability after DNS changes.Settings UI Enhancements:
Build and Dependency Cleanups:
These changes collectively ensure that DNS provider changes are handled safely and efficiently, both at startup and during runtime, with appropriate user interface feedback and network hygiene.